inscription: Multiparagraph text is always multiline
authorBenjamin Otte <otte@redhat.com>
Mon, 13 Jun 2022 02:54:19 +0000 (04:54 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 13 Jun 2022 04:49:12 +0000 (06:49 +0200)
Wrap this text and clip towards the bottom, no matter how high the
inscription is.

gtk/gtkinscription.c

index a06b78b30b9c26258f3cec1ce33990bad6dcc18e..f44937fa699c8b6d7d04e6256aab0e2f6b1d52fd 100644 (file)
@@ -476,7 +476,17 @@ gtk_inscription_allocate (GtkWidget *widget,
             PangoRectangle rect;
             pango_layout_iter_get_line_extents (iter, NULL, &rect);
             if (rect.y + rect.height > height * PANGO_SCALE)
-              pango_layout_set_width (self->layout, -1);
+              {
+                while (!pango_layout_line_is_paragraph_start (pango_layout_iter_get_line_readonly (iter)))
+                  {
+                    if (!pango_layout_iter_next_line (iter))
+                      break;
+                  }
+                if (!pango_layout_line_is_paragraph_start (pango_layout_iter_get_line_readonly (iter)))
+                  {
+                    pango_layout_set_width (self->layout, -1);
+                  }
+              }
           }
       }
       break;